home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / answers / rec / puzzles / archive / logic / part5 < prev    next >
Text File  |  1993-08-17  |  57KB  |  1,344 lines

  1. Newsgroups: rec.puzzles,news.answers,rec.answers
  2. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!spool.mu.edu!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!questrel!chris
  3. From: chris@questrel.com (Chris Cole)
  4. Subject: rec.puzzles Archive (logic), part 26 of 35
  5. Message-ID: <puzzles/archive/logic/part5_745653851@questrel.com>
  6. Followup-To: rec.puzzles
  7. Summary: This is part of an archive of questions
  8.  and answers that may be of interest to
  9.  puzzle enthusiasts.
  10.  Part 1 contains the index to the archive.
  11.  Read the rec.puzzles FAQ for more information.
  12. Sender: chris@questrel.com (Chris Cole)
  13. Reply-To: archive-comment@questrel.com
  14. Organization: Questrel, Inc.
  15. References: <puzzles/archive/Instructions_745653851@questrel.com>
  16. Date: Wed, 18 Aug 1993 06:06:26 GMT
  17. Approved: news-answers-request@MIT.Edu
  18. Expires: Thu, 1 Sep 1994 06:04:11 GMT
  19. Lines: 1322
  20. Xref: senator-bedfellow.mit.edu rec.puzzles:25010 news.answers:11530 rec.answers:1930
  21.  
  22. Archive-name: puzzles/archive/logic/part5
  23. Last-modified: 17 Aug 1993
  24. Version: 4
  25.  
  26.  
  27. ==> logic/smullyan/priest.p <==
  28. In a small town there are N married couples in which one of the pair
  29. has committed adultery.  Each adulterer has succeeded in keeping their
  30. dalliance a secret from their spouse.  Since it is a small town,
  31. everyone knows about everyone else's infidelity.  In other words, each
  32. spouse of an adulterer thinks there are N - 1 adulterers, but everyone
  33. else thinks there are N adulterers.
  34.  
  35. People of this town have a tradition of denouncing their spouse in
  36. church if they are guilty of adultery.  So far, of course, no one has
  37. been denounced.  In addition, people of this town are all amateur
  38. logicians of sorts, and can be expected to figure out the implications
  39. of anything they know.
  40.  
  41. A priest has heard the confession of all the people in the town, and is
  42. troubled by the state of moral turpitude.  He cannot break the
  43. confessional, but knowing of his flock's logical turn of mind, he hits
  44. upon a plan to do God's work.  He announces in Mass one Sunday that
  45. there is adultery in the town.
  46.  
  47. Is the priest correct?  Will this result in every adulterer being denounced?
  48.  
  49. ==> logic/smullyan/priest.s <==
  50. Yes.  Let's start with the simple case that N = 1.  The offended spouse
  51. reasons as follows: the priest knows there is at least one adulterer,
  52. but I don't know who this person is, and I would if it were anyone
  53. other than me, so it must be me.  What happens if N = 2?  On the first
  54. Sunday, the two offended spouses each calmly wait for the other to get
  55. up and condemn their spouses.  When the other doesn't stand, they
  56. think:  They do not think that they are a victim.  But if they do not
  57. think they are victims, then they must think there are no adulterers,
  58. contrary to what the priest said.  But everyone knows the priest speaks
  59. with the authority of God, so it is unthinkable that he is mistaken.
  60. The only remaining possibility is that they think there WAS another
  61. adulterer, and the only possibility is: MY SPOUSE!  So, they know that
  62. they too must be victims.  So on the next Sunday, they will get up.
  63. What if N = 3?  On the first Sunday, each victim believes that the other
  64. two will not get up because they did not know about the other person
  65. (in other words, they believe that each of the two other victims thought
  66. there was only one adulterer).  However, each victim reasons, the two
  67. will now realize that there must be two victims, for the reasons given
  68. under the N = 2 case above.  So they will get up next Sunday.  This
  69. excuse lasts until the next Sunday, when still no one gets up, and now
  70. each victim realizes that either the priest was mistaken (unthinkable!)
  71. or there are really three victims, and I am ONE!  So, on the third
  72. Sunday, all three get up.  This reasoning can be repeated inductively
  73. to show that no one will do anything (except use up N - 1 excuses as to
  74. why no one got up) until the Nth Sunday, when all N victims will arise
  75. in unison.
  76.  
  77. The induction can also be run "top down" on the priest's statement.  What
  78. must everyone believe about what everyone else believes?
  79. N victims of adultery believe there are N - 1 victims, and that all of these
  80.  N - 1 victims believe that there are N - 2 victims, and that all of these
  81.   N - 2 victims believe that there are N - 3 victims, and that all of these
  82.   ...
  83.    2 victims believe that there is 1 victim, and that this
  84.     1 victim believes there are no victims.
  85. Suppose the priest says, "There are N adulterers in this town."  Then
  86. all the adulterers will know immediately that their spouses have been
  87. unfaithful, and will denounce them the next Sunday.  Now, suppose the
  88. priest says, "There are at least N - 1 adulterers in this town."  On
  89. the first Sunday, the offended spouses all wait for each other to stand
  90. up.  When none do, they all know that they have all been horribly
  91. mistaken, and they stand up on the following Sunday.  But what if the
  92. priest says, "There are at least N - 2 adulterers in this town."  On
  93. the first Sunday, the victims reason, those N - 1 victims are going to
  94. be surprised when no one stands up, and they'll stand up next Sunday.
  95. On the second Sunday, the victims reason, wait a minute, since they
  96. didn't stand up, I must be one of the deluded victims.  And everyone
  97. stands up on the third Sunday.  This resoning applies inductively,
  98. adding one Sunday at each step, until the priest's original statement
  99. is reached, which takes N Sundays for everyone to unravel.
  100.  
  101. By the way, the rest of the town, which thinks there are N adulterers,
  102. is about to conclude that their perfectly innocent spouses have been
  103. unfaithful too.  This includes the adulterous spouses, who are about to
  104. conclude that the door swings both ways.  So the priest is playing a
  105. dangerous game.  A movie plot in there somewhere?
  106.  
  107. This problem is an analogue of the "dirty children" problem discussed in
  108. the seminal paper on common knowledge by Halpern and Moses (JACM 1990).
  109.  
  110. If the information of each victim is less than perfect, the problem is
  111. related to the "frame" problem of AI, cf. J. M. McCarthy & P. J. Hayes,
  112. "Some philosophical problems from the standpoint of artificial intelligence"
  113. (1968) in _Readings in Artificial Intelligence_ (pp. 431-450),
  114. Tioga Publishing Co., Palo Alto, CA (1981).
  115.  
  116. ==> logic/smullyan/stamps.p <==
  117. The moderator takes a set of 8 stamps, 4 red and 4 green, known to the
  118. logicians, and loosely affixes two to the forehead of each logician so that
  119. each logician can see all the other stamps except those 2 in the moderator's
  120. pocket and the two on her own head.  He asks them in turn
  121. if they know the colors of their own stamps:
  122.   A: "No"
  123.   B: "No"
  124.   C: "No"
  125.   A: "No
  126.   B: "Yes"
  127.   What are the colors of her stamps, and what is the situation?
  128.  
  129. ==> logic/smullyan/stamps.s <==
  130. B says: "Suppose I have red-red. A would have said on her 
  131. second turn: 'I see that B has red-red. If I also have red-red, then all
  132. four reds would be used, and C would have realized that she had green-green.
  133. But C didn't, so I don't have red-red.  Suppose I have green-green. In that
  134. case, C would have realized that if she had red-red, I would have seen
  135. four reds and I would have answered that I had green-green on my first
  136. turn.  On the other hand, if she also has green-green [we assume that
  137. A can see C; this line is only for completeness], then B would have seen
  138. four greens and she would have answered that she had two reds.  So C would
  139. have realized that, if I have green-green and B has red-red, and if
  140. neither of us answered on our first turn, then she must have green-red.
  141.   "'But she didn't. So I can't have green-green either, and if I can't have 
  142. green-green or red-red, then I must have green-red.'
  143.   So B continues: "But she (A) didn't say that she had green-red, so
  144. the supposition that I have red-red must be wrong.  And as my logic applies
  145. to green-green as well, then I must have green-red."
  146.   So B had green-red, and we don't know the distribution of the others
  147. certainly.
  148.   (Actually, it is possible to take the last step first, and deduce
  149. that the person who answered YES must have a solution which would work
  150. if the greens and reds were switched -- red-green.)
  151.  
  152. ==> logic/supertasks.p <==
  153. You have an empty urn, and an infinite number of labeled balls.  Each
  154. has a number written on it corresponding to when it will go in.  At a
  155. minute to the hour, you take the first ten balls and put them in the
  156. urn, and remove the last ball.  At the next half interval, you put in
  157. the next ten balls, and remove ball number 20.  At the next half
  158. interval, you put in ten more balls and remove ball 30.  This continues
  159. for the whole minute.... how many balls are in the urn at this point?
  160. (infinite)
  161.  
  162. You have the same urn, and the same set of balls.  This time, you put
  163. in 10 balls and remove ball number 1.  Then you put in another ten
  164. balls and remove ball number 2.  Then you put in another ten balls and
  165. remove ball number 3.  After the minute is over, how many balls are
  166. left in the urn now? (zero)
  167.  
  168. Are the above answers correct, and why or why not?
  169.  
  170. ==> logic/supertasks.s <==
  171. Almost all people will intuitively feel that the first experiment
  172. (where only balls labeled with multiples of 10 are removed) results in
  173. an urn with an infinite number of balls.
  174.  
  175. The real excitement starts with the experiment where balls are removed
  176. in increasing order, but 10 times slower than they are added.  Some
  177. feel that the urn will not get empty, due to the slowness of removing.
  178. Some others feel that the urn does get empty, since each ball is
  179. removed at some time during the experiment.  The remaining people claim
  180. that the experiment is not well defined, that it is not possible to do
  181. something an infinite number of times, or something similar,
  182. effectively dismissing the experiment.
  183.  
  184. Just to put a bit of doubt in some peoples mind, I will add a third experment:
  185.  
  186.   Let us suppose that at 1 minute to 12 p.m. balls nummbered 1 through 9
  187.   are placed in the urn, and instead of withdrawing a ball we add a zero
  188.   to the label of ball number 1 so that its label becomes 10. At 1/2 minute
  189.   to 12 p.m., balls numbered 11 through 19 are placed in the urn, and we
  190.   add a zero to the label of ball number 2 so that it becomes ball number 20.
  191.   At 1/4 minute to 12 p.m., balls numbered 21 through 29 are placed in the
  192.   urn and ball number 3 becomes ball number 30, and so on.
  193.   At each instant, instead of withdrawing the ball with the smallest label
  194.   we add a zero to its label so that its number is multiplied by 10.
  195.   How many balls are in the urn at 12 p.m. and what are their labels?
  196.  
  197. If we look at this experiment, at any point in time the inside of the
  198. urn looks exactly like the inside during the execution of the original
  199. paradoxical experiment. However, since no balls leave the urn, it is
  200. now impossible to conclude that the urn will be empty at 12 p.m.
  201. Still, there is no natural number that is the label of any ball in the
  202. urn.  Instead, each ball in the urn will have as its lable a natural
  203. number followed by an infinite number of zero's.
  204.  
  205. A possible question is now: does this support that the outcome of the
  206. original experiment where balls are removed in increasing order is that
  207. there are an infinite number of balls in the urn? Possibly also with
  208. 'infinite natural numbers' as their labels, or are these experiments so
  209. different that the answer is still a clear 'zero'?
  210.  
  211. I now come to the main points. 
  212. 1. Our normal mathematical models do not cater for the COMPLETION of infinite
  213.    tasks (called super tasks by Thomson in 1954).
  214. 2. Since we intuitively feel that for many of these experiments there
  215.    are obvious outcomes, we would like to enhance our model to describe the
  216.    outcomes of these experiments.
  217. 3. In the enhancement of the model continuity should play an important role.
  218.  
  219. We include statement 3, since a model in which the conclusion of all
  220. these experiments is that, at 12 p.m. the urn contains "exactly 7
  221. balls, all red" is not desirable, nor useful.
  222.  
  223. It can be easily shown that general continuity is unattainable. For
  224. instance the sentence "it is before midnight" is true during the
  225. experiment, but is suddenly false after the experiment.
  226.  
  227. The people claiming that in the second experiment the urn will contain
  228. an infinite number of balls, base this on the fact that the number of
  229. balls in the urn during the experiment, is 9n at (1/2)^(n-1) minute
  230. before 12. They thus assume that this statement is continuous. This
  231. remains to be seen, however.
  232.  
  233. We have not come to a clear set of criteria which decide whether a
  234. given statement is continuous with respect to performing supertasks. We
  235. did define a "kinematical principle of continuity", which is roughly
  236. formalised as:
  237.  
  238.     If at some moment before 12 p.m. a ball comes to rest at a particular
  239.     position, which it does not leave till 12 p.m., then it is still at
  240.     that position at 12 p.m.
  241.  
  242. If we look at the three experiments mentioned, then we can see that in
  243. each case we can come to a conclusion on the contents of the urn.
  244.  
  245. 1. In the first experiment, with the 10-folds being removed, each ball
  246.    which number is a multiple of 10 comes to rest outside the urn (just
  247.    after being removed) and thus is outside the urn at 12 p.m. All other
  248.    balls come to rest inside the urn (just after being placed there), and
  249.    thus are inside the urn at 12 p.m.  Therefore the urn contains an infinite
  250.    number of balls at 12 p.m.
  251.  
  252. 2. In the second experiment, with the balls being removed in increasing order, 
  253.    each balls comes to rest outside the urn. Thus all balls involved are not
  254.    in the urn. Thus the urn is empty.
  255.  
  256. 3. In the third experiment, all balls come to rest inside the urn and thus the
  257.    urn contains an infinite number of balls. The labels of these balls are
  258.    naturall number followed by an infinite number of zero's (since each of the
  259.    numbers is not changed, and zero's once added remain at the label, we can
  260.    draw this conclusion).
  261.  
  262. The first and third experiment are rather straightforward, while the
  263. second is paradoxical, but not inconsistent.  Please note that is just
  264. one way of extending our model to include super tasks.  We have only
  265. shown that for these experiments, in our model, we come to consistent
  266. conclusions. It does not mean that there are no other models which lead
  267. to different, but also, within that model, consistent solutions.
  268.  
  269. A final remark: while thinking about these matters, we have wondered
  270. whether we could create a model in which the second experiment would
  271. lead to an urn containing an infinite number of balls. A possibility is
  272. assuming that if a position is continuously occupied by a ball,
  273. although the occupant ball may be swapped every now and again for
  274. another ball, that at 12 p.m. the position is occupied by a so-called
  275. LIMIT BALL.  For the second experiment we could than place balls 1, 10,
  276. 100 ..  2, 20, 200, .. each at its own spot in the urn. Each spot in
  277. the urn, once occupied is than continuously occupied with a ball,
  278. leading to limit balls.
  279.  
  280. This idea of continuity is stronger than the kinematic principle
  281. suggested above, and we have not followed these ideas up enough to
  282. decide whether this extended principle can be made consistent. If any
  283. of the readers have feelings whether this can or cannot be done, I
  284. would be interested to hear their arguments.
  285.  
  286. I conclude by stating that the result of the super task depends on how
  287. our standard models are enlarged to include the execution of
  288. supertasks. We have given one extension which leads to consistent
  289. results for the supertasks suggested by Ross. Other models may lead to
  290. different, but also consistent, conclusions.
  291.  
  292. Reference:
  293.  
  294. Victor Allis and Teunis Koetsier (1991).
  295. On Some Paradoxes of the Infinite.
  296. Brit. J. Phil. Sci. 42 pp. 187-194.
  297.  
  298. -- allis@cs.rulimburg.nl (Victor Allis)
  299.  
  300. I am interested in the origin of the puzzle.  As far as I know in this
  301. form the puzzle occurs for the first time in Littlewood's "Mathematical
  302. Miscellanea", which is an amusing little booklet from the 1950s (it may
  303. be even older). Littlewood does not discuss the puzzle.  DOES ANYONE
  304. KNOW OF EARLIER REFERENCES TO THIS PUZZLE?  The puzzle also occurs in
  305. S. Ross's "A first course in probability", New York and London, 1988,
  306. without critical comment.
  307.  
  308. -- teun@cs.vu.nl (Teun Koetsier)
  309.  
  310. ==> logic/timezone.p <==
  311. Two people are talking long distance on the phone; one is in an East-
  312. Coast state of the US, the other is in a West-Coast state of the US.
  313. The first asks the other "What time is it?", hears the answer, and
  314. says, "That's funny.  It's the same time here!"
  315.  
  316. ==> logic/timezone.s <==
  317. One is in Eastern Oregon (in Mountain time), the other in
  318. Western Florida (in Central time), and it's daylight-savings
  319. changeover day at 1:30 AM.  
  320.  
  321. ==> logic/unexpected.p <==
  322. Swedish civil defense authorities announced that a civil defense drill would
  323. be held one day the following week, but the actual day would be a surprise.
  324. However, we can prove by induction that the drill cannot be held.  Clearly,
  325. they cannot wait until Friday, since everyone will know it will be held that
  326. day.  But if it cannot be held on Friday, then by induction it cannot be held
  327. on Thursday, Wednesday, or indeed on any day.
  328.  
  329. What is wrong with this proof?
  330.  
  331. ==> logic/unexpected.s <==
  332. This problem has generated a vast literature (see below).  Several
  333. solutions of the paradox have been proposed, but as with most paradoxes
  334. there is no consensus on which solution is the "right" one.
  335.  
  336. The earliest writers (O'Connor, Cohen, Alexander) see the announcement as
  337. simply a statement whose utterance refutes itself.  If I tell you that I
  338. will have a surprise birthday party for you and then tell you all the
  339. details, including the exact time and place, then I destroy the surprise,
  340. refuting my statement that the birthday will be a surprise.
  341.  
  342. Soon, however, it was noticed that the drill could occur (say on Wednesday),
  343. and still be a surprise.  Thus the announcement is vindicated instead of
  344. being refuted.  So a puzzle remains.
  345.  
  346. One school of thought (Scriven, Shaw, Medlin, Fitch, Windt) interprets
  347. the announcement that the drill is unexpected as saying that the date
  348. of the drill cannot be deduced in advanced.  This begs the question,
  349. deduced from which premises?  Examination of the inductive argument
  350. shows that one of the premises used is the announcement itself, and in
  351. particular the fact that the drill is unexpected.  Thus the word
  352. "unexpected" is defined circularly.  Shaw and Medlin claim that this
  353. circularity is illegitimate and is the source of the paradox.  Fitch
  354. uses Godelian techniques to produce a fully rigorous self-referential
  355. announcement, and shows that the resulting proposition is
  356. self-contradictory.  However, none of these authors explain how it can
  357. be that this illegitimate or self-contradictory announcement
  358. nevertheless appears to be vindicated when the drill occurs.  In other
  359. words, what they have shown is that under one interpretation of "surprise"
  360. the announcement is faulty, but their interpretation does not capture the
  361. intuition that the drill really is a surprise when it occurs and thus
  362. they are open to the charge that they have not captured the essence of
  363. the paradox.
  364.  
  365. Another school of thought (Quine, Kaplan and Montague, Binkley,
  366. Harrison, Wright and Sudbury, McClelland, Chihara, Sorenson) interprets
  367. "surprise" in terms of "knowing" instead of "deducing."  Quine claims
  368. that the victims of the drill cannot assert that on the eve of the last
  369. day they will "know" that the drill will occur on the next day.  This
  370. blocks the inductive argument from the start, but Quine is not very
  371. explicit in showing what exactly is wrong with our strong intuition
  372. that everybody will "know" on the eve of the last day that the drill
  373. will occur on the following day.  Later writers formalize the paradox
  374. using modal logic (a logic that attempts to represent propositions
  375. about knowing and believing) and suggest that various axioms about
  376. knowing are at fault, e.g., the axiom that if one knows something, then
  377. one knows that one knows it (the "KK axiom").  Sorenson, however,
  378. formulates three ingenious variations of the paradox that are
  379. independent of these doubtful axioms, and suggests instead that the
  380. problem is that the announcement involves a "blindspot":  a statement
  381. that is true but which cannot be known by certain individuals even if
  382. they are presented with the statement.  This idea was foreshadowed by
  383. O'Beirne and Binkley.  Unfortunately, a full discussion of how this
  384. blocks the paradox is beyond the scope of this summary.
  385.  
  386. Finally, there are two other approaches that deserve mention.  Cargile
  387. interprets the paradox as a game between ideally rational agents and finds
  388. fault with the notion that ideally rational agents will arrive at the same
  389. conclusion independently of the situation they find themselves in.  Olin
  390. interprets the paradox as an issue about justified belief: on the eve of
  391. the last day one cannot be justified in believing BOTH that the drill will
  392. occur on the next day AND that the drill will be a surprise even if both
  393. statements turn out to be true; hence the argument cannot proceed and the
  394. drill can be a surprise even on the last day.
  395.  
  396. For those who wish to read some of the literature, good papers to start with
  397. are Bennett-Cargile and both papers of Sorenson.  All of these provide
  398. overviews of previous work and point out some errors, and so it's helpful to
  399. read them before reading the original papers.  For further reading on the
  400. "deducibility" side, Shaw, Medlin and Fitch are good representatives.  Other
  401. papers that are definitely worth reading are Quine, Binkley, and Olin.
  402.  
  403. D. O'Connor, "Pragmatic Paradoxes," Mind 57:358-9, 1948.
  404. L. Cohen, "Mr. O'Connor's 'Pragmatic Paradoxes,'" Mind 59:85-7, 1950.
  405. P. Alexander, "Pragmatic Paradoxes," Mind 59:536-8, 1950.
  406. M. Scriven, "Paradoxical Announcements," Mind 60:403-7, 1951.
  407. D. O'Connor, "Pragmatic Paradoxes and Fugitive Propositions," Mind 60:536-8,
  408.  1951
  409. P. Weiss, "The Prediction Paradox," Mind 61:265ff, 1952.
  410. W. Quine, "On A So-Called Paradox," Mind 62:65-7, 1953.
  411. R. Shaw, "The Paradox of the Unexpected Examination," Mind 67:382-4, 1958.
  412. A. Lyon, "The Prediction Paradox," Mind 68:510-7, 1959.
  413. D. Kaplan and R. Montague, "A Paradox Regained," Notre Dame J Formal Logic
  414.  1:79-90, 1960.
  415. G. Nerlich, "Unexpected Examinations and Unprovable Statements," Mind
  416.  70:503-13, 1961.
  417. M. Gardner, "A New Prediction Paradox," Brit J Phil Sci 13:51, 1962.
  418. K. Popper, "A Comment on the New Prediction Paradox," Brit J Phil Sci 13:51,
  419.  1962.
  420. B. Medlin, "The Unexpected Examination," Am Phil Q 1:66-72, 1964.
  421. F. Fitch, "A Goedelized Formulation of the Prediction Paradox," Am Phil Q
  422.  1:161-4, 1964.
  423. R. Sharpe, "The Unexpected Examination," Mind 74:255, 1965.
  424. J. Chapman & R. Butler, "On Quine's So-Called 'Paradox,'" Mind 74:424-5, 1965.
  425. J. Bennett and J. Cargile, Reviews, J Symb Logic 30:101-3, 1965.
  426. J. Schoenberg, "A Note on the Logical Fallacy in the Paradox of the
  427.  Unexpected Examination," Mind 75:125-7, 1966.
  428. J. Wright, "The Surprise Exam: Prediction on the Last Day Uncertain," Mind
  429.  76:115-7, 1967.
  430. J. Cargile, "The Surprise Test Paradox," J Phil 64:550-63, 1967.
  431. R. Binkley, "The Surprise Examination in Modal Logic," J Phil 65:127-36,
  432.  1968.
  433. C. Harrison, "The Unanticipated Examination in View of Kripke's Semantics
  434.  for Modal Logic," in Philosophical Logic, J. Davis et al (ed.), Dordrecht,
  435.  1969.
  436. P. Windt, "The Liar in the Prediction Paradox," Am Phil Q 10:65-8, 1973.
  437. A. Ayer, "On a Supposed Antinomy," Mind 82:125-6, 1973.
  438. M. Edman, "The Prediction Paradox," Theoria 40:166-75, 1974.
  439. J. McClelland & C. Chihara, "The Surprise Examination Paradox," J Phil Logic
  440.  4:71-89, 1975.
  441. C. Wright and A. Sudbury, "The Paradox of the Unexpected Examination,"
  442.  Aust J Phil 55:41-58, 1977.
  443. I. Kvart, "The Paradox of the Surprise Examination," Logique et Analyse
  444.  337-344, 1978.
  445. R. Sorenson, "Recalcitrant Versions of the Prediction Paradox," Aust J Phil
  446.  69:355-62, 1982.
  447. D. Olin, "The Prediction Paradox Resolved," Phil Stud 44:225-33, 1983.
  448. R. Sorenson, "Conditional Blindspots and the Knowledge Squeeze: A Solution to
  449.  the Prediction Paradox," Aust J Phil 62:126-35, 1984.
  450. C. Chihara, "Olin, Quine and the Surprise Examination," Phil Stud 47:191-9,
  451.  1985.
  452. R. Kirkham, "The Two Paradoxes of the Unexpected Hanging," Phil Stud
  453.  49:19-26, 1986.
  454. D. Olin, "The Prediction Paradox: Resolving Recalcitrant Variations," Aust J
  455.  Phil 64:181-9, 1986.
  456. C. Janaway, "Knowing About Surprises: A Supposed Antinomy Revisited," Mind
  457.  98:391-410, 1989.
  458.  
  459.     -- tycchow@math.mit.edu.
  460.  
  461. ==> logic/verger.p <==
  462. A very bright and sunny Day
  463. The Priest did to the Verger say:
  464. "Last Monday met I strangers three
  465. None of which were known to Thee.
  466. I ask'd Them of Their Age combin'd
  467. which amounted twice to Thine!
  468. A Riddle now will I give Thee:
  469. Tell Me what Their Ages be!"
  470.  
  471. So the Verger ask'd the Priest:
  472. "Give to Me a Clue at least!"
  473. "Keep Thy Mind and Ears awake,
  474. And see what Thou of this can make.
  475. Their Ages multiplied make plenty,
  476. Fifty and Ten Dozens Twenty."
  477.  
  478. The Verger had a sleepless Night
  479. To try to get Their Ages right.
  480. "I almost found the Answer right.
  481. Please shed on it a little Light."
  482. "A little Clue I give to Thee,
  483. I'm older than all Strangers three."
  484. After but a little While
  485. The Verger answered with a Smile:
  486. "Inside my Head has rung a Bell.
  487. Now I know the answer well!"
  488.  
  489.  
  490. Now, the question is:
  491.  
  492. How old is the PRIEST??
  493.                ======
  494.  
  495. ==> logic/verger.s <==
  496. The puzzler tried to take the test;
  497. Intriguing rhymes he wished to best.
  498. But "Fifty and ten dozens twenty"
  499. made his headache pound aplenty.
  500. When he finally found some leisure,
  501. He took to task this witty treasure.
  502.  
  503. "The product of the age must be
  504. Twenty-Four Hundred Fifty!"
  505. Knowing that, he took its primes,
  506. permuted them as many times
  507. as needed, til he found amounts
  508. equal to, by all accounts,
  509. twice the Verger's age, so that
  510. He would have that next day's spat.
  511.  
  512. The reason for the lad's confusion
  513. was due to multiple solution!
  514. Hence he needed one more clue
  515. to give the answer back to you!
  516. Since only one could fit the bill,
  517. and then confirm the priest's age still,
  518. the eldest age of each solution
  519. by one could differ, with no coercion.  <=(Sorry)
  520.  
  521. Else, that last clue's revelation
  522. would not have brought information!
  523. With two, two, five, seven, and seven,
  524. construct three ages, another set of seven.
  525. Two sets of three yield sixty-four,
  526. Examine them, yet one time more.
  527. The eldest age of each would be
  528. forty-nine, and then, fifty!
  529.  
  530. With lack of proper rhyme and meter,
  531. I've tried to be the first completor
  532. of this poem and a puzzle;
  533. my poetry, you'd try to muzzle!
  534. And lest you think my wit is thrifty,
  535. The answer, of course, must be fifty!
  536. If dispute, you wish to tender,
  537. note my addresss, as the sender!
  538.  
  539. -- 
  540. Kevin Nechodom <knechod@stacc.med.utah.edu>
  541.  
  542. ==> logic/weighing/balance.p <==
  543. You are given 12 identical-looking coins, one of which is counterfeit
  544. and weighs slightly more or less (you don't know which) than the
  545. others.  You are given a balance scale which lets you put the same
  546. number of coins on each side and observe which side (if either) is
  547. heavier.  How can you identify the counterfeit and tell whether it
  548. is heavy or light, in 3 weighings?
  549.  
  550. More generally, you are given N coins, one of which is heavy or light.
  551.  
  552. ==> logic/weighing/balance.s <==
  553. Martin Gardner gave a neat solution to this problem.
  554.  
  555. Assume that you are allowed W weighings.  Write down the 3^W possible
  556. length W strings of the symbols '0', '1', and '2'.  Eliminate the three
  557. such strings that consist of only one symbol repeated W times.
  558.  
  559. For each string, find the first symbol that is different from the symbol
  560. preceeding it.  Consider that pair of symbols.  If that pair is not 01,
  561. 12, or 20, cross out that string.  In other words, we only allow strings
  562. of the forms 0*01.*, 1*12.*, or 2*20.* ( using ed(1) regular expressions ).
  563.  
  564. You will have (3^W-3)/2 strings left.  This is how many coins you can
  565. handle in W weighings.
  566.  
  567. Perform W weighings as follows:
  568.  
  569.     For weighing I, take all the coins that have a 0 in string
  570.     position I, and weigh them against all the coins that have
  571.     a 2 in string position I. 
  572.  
  573.     If the side with the 0's in position I goes down, write down
  574.     a 0.  If the other side goes down, write down a 2.  Otherwise,
  575.     write down a 1.
  576.  
  577. After the W weighings, you have written down an W symbol string.  If
  578. your string matches the string on one of the coins, then that is the
  579. odd coin, and it is heavy.  If none of them match, than change every
  580. 2 to a 0 in your string, and every 0 to a 2.  You will then have a
  581. string that matches one of the coins, and that coin is lighter than
  582. the others.
  583.  
  584. Note that if you only have to identify the odd coin, but don't have to
  585. determine if it is heavy or light, you can handle (3^W-3)/2+1 coins.
  586. Label the extra coin with a string of all 1's, and use the above
  587. method.
  588.  
  589. Note also that you can handle (3^W-3)/2+1 coins if you *do* have to
  590. determine whether it is heavy or light, provided you have a single reference
  591. coin available, which you know has the correct weight. You do this by
  592. labelling the extra coin with a string of all 2s. This results in it being
  593. placed on the same side of the scales each time, and in that side of the
  594. scales having one more coin than the other each time. So you put the
  595. reference coin on the other side of the scales to the "all 2s" coin on each
  596. weighing.
  597.  
  598. Proving that this works is straightforward, once you notice that the
  599. method of string construction makes sure that in each position, 1/3
  600. of the strings have 0, 1/3 have 1, and 1/3 have 2, and that if a
  601. string occurs, then the string obtained by replacing each 0 with a
  602. 2 and each 2 with a 0 does not occur.
  603.  
  604. If you already know the odd coin is heavy (or light), you can handle
  605. 3^W coins.  Given W weighings, there can only be 3^W possible
  606. combinations of balances, left pan heavy, and right pan heavy.
  607.  
  608. The algorithm in this case:
  609.  
  610. Divide the coins into three equal groups... A, B, and C. Weigh A
  611. against B. If a pan sinks, it contains the heavy coin, otherwise, the
  612. heavy coin is in group C. If your group size is 1, you've found the coin,
  613. otherwise recurse on the group containing the heavy coin.
  614.  
  615. ==> logic/weighing/box.p <==
  616. You have ten boxes; each contains nine balls.  The balls in one box
  617. weigh 0.9 kg; the rest weigh 1.0 kg.  You have one weighing on an
  618. accurate scale to find the box containing the light balls.  How do you
  619. do it?
  620.  
  621. ==> logic/weighing/box.s <==
  622. Number the boxes 0-9.  Take 0 balls from box 0, 1 ball from box 1, 2
  623. balls from box 2, etc.  Now weigh all those balls and follow this
  624. table:
  625.  
  626. If odd box is    Weight is
  627. 0        45 kg
  628. 1        44.9 kg
  629. 2        44.8 kg
  630. 3        44.7 kg
  631. 4        44.6 kg
  632. 5        44.5 kg
  633. 6        44.4 kg
  634. 7        44.3 kg
  635. 8        44.2 kg
  636. 9        44.1 kg
  637.  
  638. ==> logic/weighing/find.median.p <==
  639. What is the least number of pairwise comparisons needed to find the median of
  640. 2n+1 distinct real numbers?
  641.  
  642.  
  643. ==> logic/weighing/find.median.s <==
  644. Consider median of three numbers {a,b,c}.
  645. Let G[a,b]=max(a,b) and L[a,b]=min(a,b)
  646. If we assume that median of {a,b,c} can be computed by two
  647. comparisons, then the solution must be one of the following:
  648. G[c,G[a,b]], G[c,L[a,b]], L[c,G[a,b]], L[c,L[a,b]].
  649. However, it is easily seen that none of these provides
  650. a solution. Therefore, we need more than two comparisons to
  651. get median of three numbers.
  652.  
  653. Now, consider median of 5 numbers {a,b,c,d,e}.
  654. There are two possible ways to start the computation.
  655. Let Ci[a,b] denote the ith comparison between {a} and {b}.
  656. First, we could start with C1[a,b] and C2[c,d].
  657. Second, we could start with C2[a,C1[b,c]].
  658. We ignore other trivialities such as C1[a,a] or C2[a,C1[a,b]].
  659.  
  660. In the first case, the next operation is to find
  661. median of S={e,C1[a,b],C2[c,d]} which requires at least three
  662. comparisons in addition to the two comparisons already performed.
  663. So the total cost of the first approach is at least 5 comparisons.
  664. However, if the median is not equal to {e} then we can always
  665. choose C1 and C2 such that the median is not in S.
  666.  
  667. In the second case, the next step is to find median of S={C2[a,C1[b,c]],d,e}.
  668. Again, the total cost of this approach is at least five comparisons.
  669. If median is not equal to {d} or {e}, we can again always
  670. choose C1 and C2 such that the median is not in S.
  671.  
  672. Other starting sets, such as {e,d,c,b,a}, can always be ordered
  673. as {a,b,c,d,e}. This shows that the argument covers all possible cases.
  674.  
  675. Navid,
  676. haddadi@sipi.usc.edu
  677.  
  678. ==> logic/weighing/gummy.bears.p <==
  679. Real gummy drop bears have a mass of 10 grams, while imitation gummy
  680. drop bears have a mass of 9 grams.  Spike has 7 cartons of gummy drop bears,
  681. 4 of which contain real gummy drop bears, the others imitation.
  682. Using a scale only once and the minimum number of gummy drop bears, how
  683. can Spike determine which cartons contain real gummy drop bears?
  684.  
  685. ==> logic/weighing/gummy.bears.s <==
  686. Spike uses 51 gummy drop bears:  from the 7 boxes he takes respectively
  687. 0, 1, 2, 4, 7, 13, and 24 bears.
  688.  
  689. The notion is that each box of imitation bears will subtract its
  690. number of bears from the total "ideal" weight of 510 grams (1 gram of
  691. missing weight per bear), so Spike weighs the bears, subtracts the
  692. result from 510 to obtain a number N, and finds the unique combination
  693. of 3 numbers from the above list (since there are 3 "imitation" boxes)
  694. that sum to N.
  695.  
  696. The trick is for the sums of all triples selected from the set S of
  697. numbers of bears to be unique.  To accomplish this, I put numbers into
  698. S one at a time in ascending order, starting with the obvious choice,
  699. 0.  (Why is this obvious?  If I'd started with k > 0, then I could
  700. have improved on the resulting solution by subtracting k from each
  701. number) Each new number obviously had to be greater than any previous,
  702. because otherwise sums are not unique, but also the sums it made when
  703. paired with any previous number had to be distinct from all previous
  704. pairs (otherwise when this pair is combined with a third number you
  705. can't distinguish it from the other pair)--except for the last box,
  706. where we can ignore this point.  And most obviously all the new
  707. triples had to be distinct from any old triples; it was easy to find
  708. what the new triples were by adding the newest number to each old sum
  709. of pairs.
  710.  
  711. Now, in case you're curious, the possible weight deficits and their
  712. unique decompositions are:
  713.  
  714. 3       = 0 + 1 + 2
  715. 5       = 0 + 1 + 4
  716. 6       = 0 + 2 + 4
  717. 7       = 1 + 2 + 4
  718. 8       = 0 + 1 + 7
  719. 9       = 0 + 2 + 7
  720. 10      = 1 + 2 + 7
  721. 11      = 0 + 4 + 7
  722. 12      = 1 + 4 + 7
  723. 13      = 2 + 4 + 7
  724. 14      = 0 + 1 + 13
  725. 15      = 0 + 2 + 13
  726. 16      = 1 + 2 + 13
  727. 17      = 0 + 4 + 13
  728. 18      = 1 + 4 + 13
  729. 19      = 2 + 4 + 13
  730. 20      = 0 + 7 + 13
  731. 21      = 1 + 7 + 13
  732. 22      = 2 + 7 + 13
  733. 24      = 4 + 7 + 13
  734. 25      = 0 + 1 + 24
  735. 26      = 0 + 2 + 24
  736. 27      = 1 + 2 + 24
  737. 28      = 0 + 4 + 24
  738. 29      = 1 + 4 + 24
  739. 30      = 2 + 4 + 24
  740. 31      = 0 + 7 + 24
  741. 32      = 1 + 7 + 24
  742. 33      = 2 + 7 + 24
  743. 35      = 4 + 7 + 24
  744. 37      = 0 + 13 + 24
  745. 38      = 1 + 13 + 24
  746. 39      = 2 + 13 + 24
  747. 41      = 4 + 13 + 24
  748. 44      = 7 + 13 + 24
  749.  
  750. Note that there had to be (7 choose 3) distinct values; they end up
  751. ranging from 3 to 44 inclusive with 7 numbers missing:  4, 23, 34, 36,
  752. 40, 42, and 43.
  753.  
  754. -- David Karr (karr@cs.cornell.edu)
  755.  
  756. ==> logic/weighing/optimal.weights.p <==
  757. What is the smallest set of weights that allow you to weigh on a
  758. balance scale every integer number of kilograms up to some number N?
  759.  
  760. ==> logic/weighing/optimal.weights.s <==
  761. a) EQUATION
  762. -----------
  763. Obviously (I hate this word! :-) any weight Y that can be weighed
  764. by X1, X2, ... Xn can be written as:
  765.  
  766.     Y = A1*X1 + A2*X2 + .... + An*Xn
  767.  
  768. where Ai is equal to -1, or 0, or 1.
  769.  
  770. b) UPPER BOUND FOR Y(n)
  771. -----------------------
  772. Each Ai can have one of three values, so the total number of
  773. combinations of values for A1,A2, ... An is 3^n. At least one of these 
  774. combinations gives Y=0 (A1=A2=...=An=0). Out of the remaining 3^n-1
  775. combinations, some give a negative Y (for example A1=A2=...=An=-1).
  776. and some a positive Y (and some might also give zero values, e.g. if
  777. X1=X2, and A1=1, A2=-1).
  778. Because of symmetry it's easy to see that the combinations that give Y>0
  779. are at most half i.e. (3^n-1)/2. It is also possible that different
  780. combinations might give the same value of Y, and it is also possible
  781. that these values of Y are not successive.
  782. However, to obtain an upper bound, lets assume the best case i.e.
  783. all (3^n-1)/2 combinations give different, positive, and successive
  784. values, so:
  785.     Y(n) <= (3^n-1)/2
  786.  
  787. c) AN OPTIMAL ALGORITHM FOR CHOOSING Xn
  788. ---------------------------------------
  789. I will present an algorithm for choosing the weights X1,X2,...Xn.
  790. Then we will prove that it is optimal.
  791.  
  792. For n=1, we choose X1=1, and of course Y(1) = 1.
  793.  
  794. Let's assume that we have already chosen n weights X1, X2 ... Xn,
  795. and that we can weigh all Y where 1<=Y<=Y(n).
  796. We are allowed to get an extra new weight Xn+1.
  797. If we choose:
  798.     Xn+1 = 2*Y(n)+1
  799. then we get
  800.     Y(n+1) = Y(n) + Xn+1 = 3*Y(n)+1
  801.  
  802. Proof:
  803.     for 1<= Y <= Y(n):
  804.     use the weights X1...Xn (ignoring the new one)
  805.     for Y(n)+1 <= Y < Xn+1 = 2*Y(n)+1
  806.     Put Xn+1 on one side of the scale, and on the other side put
  807.     the unknown weight, and a combination of X1...Xn so that
  808.     this combination weighs "Xn+1 - Y" (which is a number
  809.     in the range 0...Y(n), so *there exists* such a combination)
  810.     for 2*Y(n)+1 <= Y <= 3*Y(n)+1:
  811.     put the unknown weight on one side, and on the other side
  812.     put Xn+1, and combination of X1...Xn with a weight equal to
  813.     "Y - Xn+1" (which again is a number in the range 0...Y(n),
  814.     so there exists such a combination)
  815.  
  816. So, to summarize, if we use such an algorithm, we have:
  817.     X1 = 1;
  818.     Y(1) =1;
  819.  
  820.     Xn+1 = 2*Y(n)+1
  821.     Y(n+1) = Y(n) + Xn+1 = 3*Y(n) + 1
  822.  
  823. It's easy to prove (e.g. by induction) that:
  824.     Y(n) = (3^n-1)/2
  825.     X(n) = 3^n
  826.  
  827. So, Y(n) is equal to the upper bound we found before, so this algorithm is
  828. optimal, and the weights you must choose are powers of 3.
  829.  
  830. Spyros Potamianos
  831. potamian@hpl.hp.com
  832.  
  833.  
  834. ==> logic/weighing/weighings.p <==
  835. Some of the supervisors of Scandalvania's n mints are producing bogus coins.
  836. It would be easy to determine which mints are producing bogus coins but,
  837. alas, the only scale in the known world is located in Nastyville,
  838. which isn't on very friendly terms with Scandalville.  In fact, Nastyville's
  839. king will only let you use the scale twice.  Your job?  You must determine
  840. which of the n mints are producing the bogus coins using only two weighings
  841. and the minimum number of coins (your king is rather parsimonious, to put it
  842. nicely).  This is a true scale, i.e. it will tell you the weight of whatever
  843. you put on it.  Good coins are known to have a weight of 1 ounce and it is
  844. also known that all the bogus mints (if any) produce coins that are
  845. light or heavy by the same amount.
  846.  
  847. Some examples: if n=1 then we only need 1 coin, if n=2 then clearly 2
  848. coins suffice, one from each mint.
  849.  
  850. What are the solutions for n=3,4,5?  What can be said for general n?
  851.  
  852. ==> logic/weighing/weighings.s <==
  853. Oh gracious and wise king, I have solved this problem by first
  854. simplifying and then expanding.  That is, consider the problem of
  855. being allowed only a single weighing.  Stop reading right now if you
  856. want to think about it further.
  857.  
  858. There are three possible outcomes for each mint (light, OK, heavy)
  859. which may be represented as (-1, 0, +1).  Now, let each mint represent
  860. one place in base 3.  Thus, the first mint is the ones place, the
  861. second the threes place, the third is the nines place and so on.  The
  862. number of coins from each mint must equal the place.  That is, we'll
  863. have 1 coin from mint 1, 3 from mint 2, 9 from mint 3, and, in
  864. general, 3^(n-1) from mint n.
  865.  
  866. By weighing all coins at once, we will get a value between 1 + 3 + 9 +
  867. ...  and -1 + -3 + -9 + ...  In fact, we notice that that value will
  868. be unique for any mint outcomes.  Thus, for the one weighing problem,
  869. we need
  870.  
  871. sum for i=1 to n (3^(i-1))
  872.  
  873. which evaluates to (3^n - 1)/2
  874.  
  875. I'm fairly satisfied that this is a minimum for a single weighing.
  876. What does a second weighing give us?  Well, we can divide the coins
  877. into two groups and use the same method.  That is, if we have 5 mints,
  878. one weighing will be:
  879.  
  880. 1 coin from mint 1 + 3 coins from mint 2 + 9 coins from mint 3
  881.  
  882. while the other weighing will be:
  883.  
  884. 1 coin from mint 4 + 3 coins from mint 5
  885.  
  886. It's pretty plain that this gives us a total coinage of:
  887.  
  888.    3^(n/2) - 1 for even n and, after some arithmetic agitation:
  889.    2 * 3^((n-1)/2) - 1 for odd n
  890.  
  891. I think the flaw in this solution is that we don't know ahead of time
  892. the amount by which the coins are off weight.  So if you weigh 1 coin
  893. from mint 1 together with 3 coins from mint 2 and the result is heavy
  894. by 3x units, you still don't know whether the bogus coins are from
  895. mint 3 (heavy by x units) or from mint 1 (heavy by 3x units).  Note
  896. that we're not given the error amount, only the fact that is is equal
  897. for all bogus coins.
  898.  
  899. Here is my partial solution:
  900.  
  901. After considering the above, it would seem that on each of the two
  902. weighings we must include coins from all of the mints (except for the
  903. special cases of small n).  So let ai (a sub i) be the number of coins
  904. from mint i on weighing 1 and bi be the number of coins from mint i on
  905. weighing 2.  Let the error in the bogus coins have a value x, and let
  906. ci be a the counterfeit function: ci is 0 if mint i is good, 1
  907. otherwise.
  908.  
  909. Then
  910.     Sum   ai ci x = delta1        error on weighing 1
  911.     Sum   bi ci x = delta2        error on weighing 2
  912.  
  913. Now the ratio of delta1 to delta2 will be rational regardless of the
  914. value of x, since x will factor out; let's call this ratio p over q (p
  915. and q relatively prime).  We would like to choose { ai } and { bi }
  916. such that for any set of mints J, which will be a subset of { 1 , 2 ,
  917. ... , n }, that
  918.  
  919.     Sum aj    ( = Sum  ai ci ) is relatively prime to Sum bj.
  920.  
  921. If this is true then we can determine the error x; it will simply be
  922. delta1/p, which is equal to  delta2/q.
  923.  
  924. If the { ai } have been carefully chosen, we should be able to figure
  925. out the bogus mints from one of the weighings, provided that
  926. all subsets ( { { aj } over all J } ) have unique sums.
  927. This was the strategy proposed above, where is was suggested
  928. that ai = 3 ** (i-1) ; note that you can use base 2 instead
  929. of base 3 since all the errors have the same sign.
  930.  
  931. Well, for the time being I'm stumped.
  932.  
  933. This agrees with the analysis I've been fighting with.  I actually
  934. came up with a pair of functions that "almost" works.  So that the
  935. rest of you can save some time (in case you think the way I did):
  936.     Weighing 1: 1 coin from each mint
  937.     Weighing 2: 2^(k-1) coins from mint k, for 1...k...n 
  938.     (total 2^n - 1 coins)
  939.  
  940. Consider the n mints to be one-bit-each -- bit set -> mint makes bogus
  941. coins.  Then we can just state that we're trying to discover "K",
  942. where K is a number whose bit pattern _just_ describes the bogosity of
  943. each mint.  OK - now, assuming we know 'x', and we only consider the
  944. *difference* of the weighing from what it should be, for weighing 1,
  945. the devaiation is just the Hamming weight of K -- that is the number
  946. of 1-bits in it -- that is, the number of bogosifying mints.  For
  947. weighing 2, the deviation is just K!  When the nth bit of K is set,
  948. then that mint contributes just 2^n to the deviation, and so the total
  949. deviation will just be K.
  950.  
  951. So that set me in search of a lemma: given H(x) is the hamming weight
  952. of x, is f(x) = x / H(x) a 1-1 map integers into rationals?  That is,
  953. if x/H(x) = y/H(y) can we conclude that x = y?
  954.  
  955. The answer (weep) is NO.  The lowest pair I could find are 402/603
  956. (both give the ratio 100.5).  Boy it sure looked like a good
  957. conjecture for a while!  Sigh.
  958.  
  959.  
  960. There are two parts to the problem. First let us try to come up with a 
  961. solution to finding the answer in 2 weighings - then worry about using the
  962. min. number of coins.
  963. Solutions are for GENERAL n.
  964.  
  965. Let N = set of all mints, 1 to n. Card(N) = n.
  966. Let P = set of all bogus mints. Let Card(P) = p.
  967.  
  968. Weighing I: Weigh n coins, 1 from each mint.
  969.  
  970. Since each "good" coins weighs one ounce, let delta1 be the error in weighing.
  971. Since all bogus coins are identical, let delta1 be abs(error).
  972. If x is the weight by which one bogus coin differs from a good coin,
  973.  delta1 = p * x.
  974.  
  975. Weighing II: The coins to be weighed are composed thusly.
  976.  
  977. Let a1 be the number of coins from mint 1, a2 # from mint2 .. and an from
  978. mint n. All ai's are distinct integers.
  979.  
  980. Let A = Set of all ai's.
  981.  
  982. Let delta2 = (abs.) error in weighing 2 = x * k
  983.     where k is the number of coins that are bogus in weighing two.
  984. Or more formally
  985.         k = sigma(ai)
  986.          (over all i in P)
  987.  
  988. Assuming p is not zero (from Weighing I - in that case go back and get beheaded
  989. for giving the king BAAAAAD advice), 
  990.     Let ratio = delta1/delta2 = p/k.
  991.     Let IR = delta2/delta1 = k/p = inverse-ratio (for later proof).
  992.  
  993. Let S(i) be the bag of all numbers generated by summing i distinct elements 
  994. from A. Clearly there will be nCi (that n comb. i) elements in S(i).
  995.  
  996. [A bag is a set that can have the same element occur more than once.]
  997.  
  998. So S(1) = A
  999. and S(n) will have one element that is the sum of all the elements of A.
  1000.  
  1001. Let R(i) = {x : For-all y in S(i), x = i/y} expressed as p/q (no common 
  1002.                                 factors).
  1003. (R is a bag too).
  1004.  
  1005. Let R-A = Bag-Union(R(i) for 1>= i >=n). (can include same element twice)
  1006.  
  1007. Choose A, such that all elements of R-A are DISTINCT, i.e. Bag(R-A) = Set(R-A).
  1008.  
  1009. Let the sequence a1, a2, .. an, be an L-sequence if the above property is
  1010. true. Or more simply, A is in L.
  1011.  
  1012. **********************************************************************
  1013. CONJECTURE: The bogus mint problem is solved in two weighings if A is in L.
  1014.  
  1015. Sketchy proof: R(1) = all possible ratios (= delta1/delta2) when p=1.
  1016. R(i) = all possible ratio's when p=i.
  1017.  
  1018. Since all possible combinations of bogus mints are reflected in R, just match
  1019. the actual ratio with the generated table for n.
  1020.  
  1021. ************************************************************************
  1022. A brief example. Say n=3. Skip to next line if you want.
  1023. Let A=(2,3,7).
  1024.  
  1025. p=1 possible ratios = 1/2 1/3 1/7
  1026. p=2 possible ratios = 2/5 2/9 1/5(2/10)
  1027. p=3 possible ratios = 1/4(3/12) (lots of blood in Scandalvania).
  1028.  
  1029. As all outcomes are distinct, and the actual ratio MUST be one of these,
  1030. match it to the answer, and start sharpening the axe.
  1031.  
  1032. Note that the minimum for n=3 is A=(0,1,3)
  1033. possible ratios are 
  1034. p=1 infinity (delta2=0),1,1/3
  1035. p=2 2/1,2/3,1/2
  1036. p=3 3/4
  1037.  
  1038. ************************************************************************
  1039.  
  1040. All those with the determination to get this far are saying OK, OK how do we
  1041. get A.
  1042.  
  1043. I propose a solution that will generate A, to give you the answer in two
  1044. weighings, but will not give you the optimal number of coins.
  1045.  
  1046. Let a1=0
  1047.  
  1048. For i>=2 >=n
  1049.  
  1050. ai = i*(a1 + a2 + ... + ai-1) + 1
  1051.  
  1052. *****************************************
  1053. *        i-1            *
  1054. *    ai = i* [Sigma(aj)] + 1     *   ****Generator function G*****
  1055. *        j=1            *
  1056. *****************************************
  1057.  
  1058. If A is L, all RATIO's are unique. Also all inverse-ratio's (1/ratio) are
  1059. unique. I will prove that all inverse-ratio's (or IR's) are unique.
  1060.  
  1061. Let A(k), be the series generated by the first k elements from eqn. G.(above)
  1062.  
  1063. ************************************************************************
  1064.  
  1065. PROOF BY INDUCTION.
  1066.  
  1067. A(1) = {0} is in L.
  1068. A(2) = {0,1} is in L.
  1069.  
  1070. ASSUME A(k) = {0,1, ..., ak} is in L.
  1071.  
  1072. T.P.T. A(k+1) = {0,1, ..., ak, D) is in L where D is generated from G.
  1073.  
  1074. We know that all IR's(inverse ratio's)  from A(k) are distinct.
  1075.  
  1076. Let K = set of all IR's of A(k).
  1077.  
  1078. Since A(k+1) contains A(k), all IR's of A(k) will also be IR's of A(K+1).
  1079.  
  1080. So for all P, such that (k+1) is not in P, we get a distinct IR.
  1081.  
  1082. So consider cases when (k+1) is in P.
  1083.  
  1084. p=1 (i.e. (k+1) = only bogus mint), IR = D
  1085.  
  1086. ______________________________________________________________________
  1087. CONJECTURE: Highest IR for A(k) = max(K) = ak
  1088.  
  1089. Proof:     Since max[A(k)] = ak,
  1090.         for p'= 1, max IR = ak/1 = ak
  1091.         for p'= 2, max IR (max sum of 2 ai's)/2
  1092.                = (ak + ak-1)/2 < ak (as ak>ak-1).
  1093.         for p'= i max IR sum of largest i elements of A(k)
  1094.                       --------------------------------
  1095.                         i
  1096.                 < i * ak/i = ak.
  1097.     So max. IR for A(k) is ak.
  1098. ______________________________________________________________________
  1099.  
  1100. D > ak
  1101. So for p=1 IR is distinct.
  1102.  
  1103. Let Xim be the IR formed by choosing i elements from A(k+1). 
  1104.     Note: We are choosing D and (i-1) elements from A(k).
  1105.           m is just an index to denote each distinct combination of
  1106.           (i-1) elemnts of A(i).
  1107.  
  1108. ______________________________________________________________________
  1109. CONJECTURE : For p=j, all new IR's Xjm are limited to the range
  1110.          D/(j-1) > Xjm > D/j.
  1111.  
  1112. Proof:
  1113.     Xjm = (D + {j-1 elements of A(k)})/j
  1114.  
  1115.     Clearly Xjm > D/j.
  1116.  
  1117.     To show: max[Xjm] < D/(j-1)
  1118.  
  1119.     Note: a1 + a2 .. + ak < D/(k+1)
  1120.  
  1121.        max[Xjm] = (D + ak + ak-1 +  ... + a(k-j+1))/j
  1122.         < (D + D/(k+1))/j
  1123.         = D (k+2)/(k+1)j
  1124.         = [D/(j-1)] * alpha.
  1125.  
  1126.     alpha = (j-1)/(j)  *  (k+2)/(k+1)
  1127.         
  1128.         Since j <= k, (j-1)/j <= (k-1)/k < (k+1)/(k+2)
  1129.  
  1130.     IMPLIES alpha < 1.
  1131.  
  1132. Conjecture proved.
  1133.  
  1134. ______________________________________________________________________
  1135. CONJECTURE : For a given p, all newly generated IR's are distinct.
  1136.  
  1137. Proof by contradiction:
  1138.  
  1139. Assume this is not so.
  1140.  
  1141. Implies
  1142.     (D + (p-1) elements of A(k))/p 
  1143.     = (D + some other (p-1) elements of A(k))/p 
  1144.  
  1145. Implies SUM[(p-1) elements of A(k)] = SUM[ some other (p-1) elements of A(k)]
  1146.  
  1147. Implies SUM[(p-1) elements of A(k)]/(p-1) 
  1148.         = SUM[some other (p-1) elements]/(p-1)
  1149.  
  1150. Implies A(k) is NOT in L.
  1151.  
  1152. Contra.
  1153.  
  1154. Hence conjecture.
  1155. ______________________________________________________________________
  1156.  
  1157. CONJECTURE: A(k+1) is in L.
  1158.  
  1159. Since all newly generated IR's are distinct from each other, and all newly generated IR's are greater than previous IR's, A(k+1) is in L.
  1160.  
  1161. ==> logic/zoo.p <==
  1162.  I took some nephews and nieces to the Zoo, and we halted at a cage marked
  1163.  
  1164.             Tovus Slithius, male and female.
  1165.           Beregovus Mimsius, male and female.
  1166.              Rathus Momus, male and female.
  1167.         Jabberwockius Vulgaris, male and female.
  1168.  
  1169.  The eight animals were asleep in a row, and the children began to guess
  1170.  which was which.  "That one at the end is Mr Tove."  "No, no!  It's Mrs
  1171.  Jabberwock," and so on.  I suggested that they should each write down
  1172.  the names in order from left to right, and offered a prize to the one
  1173.  who got most names right.
  1174.  
  1175.  As the four species were easily distinguished, no mistake would arise in
  1176.  pairing the animals; naturally a child who identified one animal as Mr
  1177.  Tove identified the other animal of the same species as Mrs Tove.
  1178.  
  1179.  The keeper, who consented to judge the lists, scrutinised them carefully.
  1180.  "Here's a queer thing.  I take two of the lists, say, John's and Mary's.
  1181.  The animal which John supposes to be the animal which Mary supposes to be
  1182.  Mr Tove is the animal which Mary supposes to be the animal which John
  1183.  supposes to be Mrs Tove.  It is just the same for every pair of lists,
  1184.  and for all four species.
  1185.  
  1186.  "Curiouser and curiouser!  Each boy supposes Mr Tove to be the animal
  1187.  which he supposes to be Mr Tove; but each girl supposes Mr Tove to be
  1188.  the animal which she supposes to be Mrs Tove.  And similarly for the oth-
  1189.  er animals.  I mean, for instance, that the animal Mary calls Mr Tove
  1190.  is really Mrs Rathe, but the animal she calls Mrs Rathe is really Mrs
  1191.  Tove."
  1192.  
  1193.  "It seems a little involved," I said, "but I suppose it is a remarkable
  1194.  coincidence."
  1195.  
  1196.  "Very remarkable," replied Mr Dodgson (whom I had supposed to be the
  1197.  keeper) "and it could not have happened if you had brought any more
  1198.  children."
  1199.  
  1200.  How many nephews and nieces were there?  Was the winner a boy or a girl?
  1201.  And how many names did the winner get right?    [by Sir Arthur Eddington]
  1202.  
  1203. ==> logic/zoo.s <==
  1204. Given that there is at least one boy and one girl (John and Mary are
  1205. mentioned) then the answer is that there were 3 nephews and 2 nieces,
  1206. the winner was a boy who got 4 right.
  1207.  
  1208. Number the animals 1 through 8, such that the females are even and the
  1209. males are odd, with members of the same species consecutive; i.e.  1 is
  1210. Mr. Tove, 2 Mrs. Tove, etc.
  1211.  
  1212. Then each childs guesses can be represented by a permutation.  I use
  1213. the standard notation of a permutation as a set of orbits.  For
  1214. example: (1 3 5)(6 8) means 1 -> 3, 3 -> 5, 5 -> 1, 6 -> 8, 8 -> 6 and
  1215. 2,4,7 are unchanged.
  1216.  
  1217. [1]  Let P be any childs guesses.  Then P(mate(i)) = mate(P(i)).
  1218.  
  1219. [2]  If Q is another childs guesses, then [P,Q] = T, where [P,Q] is the
  1220. commutator of P and Q (P composed with Q composed with P inverse
  1221. composed with Q inverse) and T is the special permutation (1 2) (3 4)
  1222. (5 6) (7 8) that just swaps each animal with its spouse.
  1223.  
  1224. [3]  If P represents a boy, then P*P = I (I use * for composition, and
  1225. I for the identity permutation: (1)(2)(3)(4)(5)(6)(7)(8)
  1226.  
  1227. [4]  If P represents a girl, then P*P = T.
  1228.  
  1229. [1] and [4] together mean that all girl's guesses must be of the form:
  1230.     (A B C D) (E F G H) where A and C are mates, as are B & D,
  1231.     E & F G & H.
  1232.  
  1233. So without loss of generality let Mary = (1 3 2 4) (5 7 6 8)
  1234. Without to much effort we see that the only possibilities for other
  1235. girls "compatible" with Mary (I use compatible to mean the relation
  1236. expressed in [2]) are:
  1237.     g1:  (1 5 2 6) (3 8 4 7)
  1238.     g2:  (1 6 2 5) (3 7 4 8)
  1239.     g3:  (1 7 2 8) (3 5 4 6)
  1240.     g4:  (1 8 2 7) (3 6 4 5)
  1241.  
  1242. Note that g1 is incompatible with g2 and g3 is incompatible with g4.
  1243. Thus no 4 of Mary and g1-4 are mutually compatible.  Thus there are at
  1244. most three girls: Mary, g1 and g3 (without loss of generality)
  1245.  
  1246. By [1] and [3], each boy must be represented as a product of
  1247. transpostions and/or singletons: e.g. (1 3) (2 4) (5) (6) (7) (8) or
  1248. (1) (2) (3 4) (5 8) (6 7).
  1249.  
  1250. Let J represent John's guesses and consider J(1).
  1251. If J(1) = 1, then J(2) = 2 (by [1]) using [2] and Mary J(3) = 4, J(4) =
  1252. 3,  and g1 & J => J(5) = 6, J(6) = 5, & g3 & J => J(8) = 7 J(7) = 8
  1253. i.e. J = (1)(2)(3 4)(5 6)(7 8).  But the [J,Mary] <> T.  In fact, we
  1254. can see that J must have no fixed points, J(i) <> i for all i, since
  1255. there is nothing special about i = 1.
  1256.  
  1257. If J(1) = 2, then we get from Mary that J(3) = 3.  contradiction.
  1258.  
  1259. If J(1) = 3, then J(2) = 4, J(3) = 1, J(4) = 2 (from Mary) =>
  1260.    J(5) = 7, J(6) = 8, J(7) = 5, J(8) = 6 => J = (1 3)(2 4)(5 7)(6 8)
  1261.    (from g1)
  1262. But then J is incompatible with g3.
  1263.  
  1264. A similar analysis shows that J(1) cannot be 4,5,6,7 or 8; i.e. no J 
  1265. can be compatible with all three girls.  So without loss of generality,
  1266. throw away g3.
  1267.  
  1268. We have Mary = (1 3 2 4) (5 7 6 8)
  1269.         g1   = (1 5 2 6) (3 8 4 7)
  1270.  
  1271. The following are the only possible boy guesses which are compatible
  1272. with
  1273. both of these:
  1274.  
  1275.   B1: (1)(2)(3 4)(5 6)(7)(8)
  1276.   B2: (1 2)(3)(4)(5)(6)(7 8)
  1277.   B3: (1 3)(2 4)(5 7)(6 8)
  1278.   B4: (1 4)(2 3)(5 8)(6 7)
  1279.   B5: (1 5)(2 6)(3 8)(4 7)
  1280.   B6: (1 6)(2 5)(3 7)(4 8)
  1281.  
  1282. Note that B1 & B2 are incombatible, as are B3 & B4, B5 & B6, so at most
  1283. three of them are mutually compatible.  In fact, Mary, g1, B1, B3 and
  1284. B5 are all mutually compatible (as are all the other possibilities you
  1285. can get by choosing either B1 or B2, B3 or B4, B5 or B6.  So if there
  1286. are 2 girls there can be 3 boys, but no more, and we have already
  1287. eliminated the case of 3 girls and 1 boy.
  1288.  
  1289. The only other possibility to consider is whether there can be 4 or
  1290. more boys and 1 girl.  Suppose there are Mary and 4 boys.  Each boy
  1291. must map 1 to a different digit or they would not be mutually
  1292. compatible.  For example if b1 and b2 both map 1 to 3, then they both
  1293. map 3 to 1 (since a boy's map consists of transpositions), so both
  1294. b1*b2 and b2*b1 map 1 to 1.  Furthermore, b1 and b2 cannot map 1 onto
  1295. spouses.  For example, if b1(1) = a and b is the spouse of a, then
  1296. b1(2) = b.  If b2(1) = b, then b2(2) = a.  Then b1*b2(1) = b1(b) = 2
  1297. and b2*b1(1) = b2(a) = 2 (again using the fact that boys are all
  1298. transpostions).  Thus the four boys must be:
  1299.  
  1300. B1: (1)(2)...    or (1 2)....
  1301. B2: (1 3)...     or (1 4) ...
  1302. B3: (1 5) ...    or (1 6) ...
  1303. B4: (1 7) ...    or (1 8) ...
  1304.  
  1305. Consider B4.  The only permutation of the form (1 7)... which is
  1306. compatible
  1307. with Mary ( (1 3 2 4) (5 7 6 8) ) is:
  1308.  
  1309.    (1 7)(2 8)(3 5)(4 6)
  1310.  
  1311. The only (1 8)... possibility is:
  1312.  
  1313.    (1 8)(2 7)(3 6)(4 5)
  1314.  
  1315. Suppose B4 = (1 7)(2 8)(3 5)(4 6)
  1316.  
  1317. If B3 starts (1 5), it must be (1 5)(2 6)(3 8)(4 7) to be compatible
  1318. with B4.  This is compatible with Mary also.
  1319.  
  1320. Assuming this and B2 starts with (1 3) we get B2 = (1 3)(2 4)(5 8)(6 7)
  1321. in order to be compatible with B4.  But then B2*B3 and B3*B2 moth map 1
  1322. to 8.  I.e. no B2 is mutually compatible with B3 & B4.
  1323.  
  1324. Similarly if B2 starts with (1 4) it must be (1 4)(2 3)(5 7)(6 8) to
  1325. work with B4, but this doesn't work with B3.
  1326.  
  1327. Likewise B3 starting with (1 6) leads to no possible B2 and the
  1328. identical reasoning eliminates B4 = (1 8)...
  1329.  
  1330. So no B4 is possible!
  1331.  
  1332. I.e at most 3 boys are mutually compatiblw with Mary, so 2 girls & 3
  1333. boys is optimal.
  1334.  
  1335. Thus:
  1336.  
  1337. Mary = (1 3 2 4) (5 7 6 8)
  1338. Sue  = (1 5 2 6) (3 8 4 7)  
  1339. John = (1)(2)(3 4)(5 6)(7)(8)
  1340. Bob  = (1 3)(2 4)(5 7)(6 8)
  1341. Jim  = (1 5)(2 6)(3 8)(4 7)
  1342.  
  1343. is one optimal solution, with the winner being John (4 right: 1 2 7 & 8)
  1344.